#include <iostream>
#include <algorithm>

using namespace std;

int q;
int a, b, c;
int main()
{
    cin >> q;
    while (q--)
    {
        cin >> a >> b >> c;
        int t1 = min(min(a, b), c);
        int t2 = max(0, b - t1 - 1);
        cout << t1 * 2 + t2 << endl;
    }

    return 0;
}